home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / p / pcqpascalv1.2d.lha / Include / Libraries / ConfigRegs.i < prev    next >
Text File  |  1997-05-06  |  10KB  |  256 lines

  1. {
  2.  
  3.         ConfigRegs.i for PCQ Pascal
  4.  
  5.         register and bit definitions for expansion boards
  6. }
  7.  
  8. {
  9. ** AutoConfig (tm) boards each contain a 32 byte "ExpansionRom" area that is
  10. ** read by the system software at configuration time.  Configuration of each
  11. ** board starts when the ConfigIn* signal is passed from the previous board
  12. ** (or from the system for the first board).  Each board will present it's
  13. ** ExpansionRom structure at location $00E80000 to be read by the system.
  14. ** This file defines the appearance of the ExpansionRom area.
  15. **
  16. ** Expansion boards are actually organized such that only one nybble per
  17. ** 16 bit word contains valid information.  The low nybbles of each
  18. ** word are combined to fill the structure below. (This table is structured
  19. ** as LOGICAL information.  This means that it never corresponds exactly
  20. ** with a physical implementation.)
  21. **
  22. ** The ExpansionRom space is further split into two regions:  The first 16
  23. ** bytes are read-only.  Except for the er_type field, this area is inverted
  24. ** by the system software when read in.  The second 16 bytes contain the
  25. ** control portion, where all read/write registers are located.
  26. **
  27. ** The system builds one "ConfigDev" structure for each board found.  The
  28. ** list of boards can be examined using the expansion.library/FindConfigDev
  29. ** function.
  30. **
  31. ** A special "hacker" Manufacturer ID number is reserved for test use:
  32. ** 2011 ($7DB).  When inverted this will look like $F824.
  33. }
  34.  
  35. Type
  36.  
  37.     ExpansionRom = record
  38.         er_Type         : Byte;
  39.         er_Product      : Byte;
  40.         er_Flags        : Byte;
  41.         er_Reserved03   : Byte;
  42.         er_Manufacturer : Short;
  43.         er_SerialNumber : Integer;
  44.         er_InitDiagVec  : Short;
  45.         er_Reserved0c   : Byte;
  46.         er_Reserved0d   : Byte;
  47.         er_Reserved0e   : Byte;
  48.         er_Reserved0f   : Byte;
  49.     end;
  50.     ExpansionRomPtr = ^ExpansionRom;
  51.  
  52. {
  53. ** Note that use of the ec_BaseAddress register is tricky.  The system
  54. ** will actually write twice.  First the low order nybble is written
  55. ** to the ec_BaseAddress register+2 (D15-D12).  Then the entire byte is
  56. ** written to ec_BaseAddress (D15-D8).  This allows writing of a byte-wide
  57. ** address to nybble size registers.
  58. }
  59.  
  60.     ExpansionControl = record
  61.         ec_Interrupt    : Byte;         { interrupt control register }
  62.         ec_Reserved11   : Byte;
  63.         ec_BaseAddress  : Byte;         { set new config address }
  64.         ec_Shutup       : Byte;         { don't respond, pass config out }
  65.         ec_Reserved14   : Byte;
  66.         ec_Reserved15   : Byte;
  67.         ec_Reserved16   : Byte;
  68.         ec_Reserved17   : Byte;
  69.         ec_Reserved18   : Byte;
  70.         ec_Reserved19   : Byte;
  71.         ec_Reserved1a   : Byte;
  72.         ec_Reserved1b   : Byte;
  73.         ec_Reserved1c   : Byte;
  74.         ec_Reserved1d   : Byte;
  75.         ec_Reserved1e   : Byte;
  76.         ec_Reserved1f   : Byte;
  77.     end;
  78.     ExpansionControlPtr = ^ExpansionControl;
  79.  
  80. {
  81. ** many of the constants below consist of a triplet of equivalent
  82. ** definitions: xxMASK is a bit mask of those bits that matter.
  83. ** xxBIT is the starting bit number of the field.  xxSIZE is the
  84. ** number of bits that make up the definition.  This method is
  85. ** used when the field is larger than one bit.
  86. **
  87. ** If the field is only one bit wide then the xxB_xx and xxF_xx convention
  88. ** is used (xxB_xx is the bit number, and xxF_xx is mask of the bit).
  89. }
  90.  
  91. Const
  92.  
  93. { manifest constants }
  94.  
  95.            E_SLOTSIZE          = $10000;
  96.            E_SLOTMASK          = -1;
  97.            E_SLOTSHIFT         = 16;
  98.  
  99. { these define the two free regions of Zorro memory space.
  100. ** THESE MAY WELL CHANGE FOR FUTURE PRODUCTS!
  101. }
  102.  
  103.            E_EXPANSIONBASE     = $e80000;
  104.            EZ3_EXPANSIONBASE   = $ff000000;      {           Zorro III config address }
  105.            E_EXPANSIONSIZE     = $080000;
  106.            E_EXPANSIONSLOTS    = 8;
  107.  
  108.            E_MEMORYBASE        = $200000;
  109.            E_MEMORYSIZE        = $800000;
  110.            E_MEMORYSLOTS       = 128;
  111.  
  112.            EZ3_CONFIGAREA      =    $40000000;      {           Zorro III space }
  113.            EZ3_CONFIGAREAEND   =    $7FFFFFFF;      {           Zorro III space }
  114.            EZ3_SIZEGRANULARITY =    $00080000;      {           512K increments }
  115.  
  116.  
  117.  
  118. {          *** er_Type definitions (ttldcmmm) **************************************}
  119.  
  120. {           er_Type board type bits -- the OS ignores "old style" boards }
  121.            ERT_TYPEMASK          =  $c0;    {Bits 7-6 }
  122.            ERT_TYPEBIT           =  6  ;
  123.            ERT_TYPESIZE          =  2  ;
  124.            ERT_NEWBOARD          =  $c0;
  125.            ERT_ZORROII           =  ERT_NEWBOARD;
  126.            ERT_ZORROIII          =  $80;
  127.  
  128. {           other bits defined in er_Type }
  129.            ERTB_MEMLIST          =  5;   {           Link RAM into free memory list }
  130.            ERTB_DIAGVALID        =  4;   {           ROM vector is valid }
  131.            ERTB_CHAINEDCONFIG    =  3;   {           Next config is part of the same card }
  132.  
  133.            ERTF_MEMLIST          =  32;
  134.            ERTF_DIAGVALID        =  16;
  135.            ERTF_CHAINEDCONFIG    =  8;
  136.  
  137. {           er_Type field memory size bits }
  138.            ERT_MEMMASK           =  $07;    {Bits 2-0 }
  139.            ERT_MEMBIT            =  0  ;
  140.            ERT_MEMSIZE           =  3  ;
  141.  
  142.  
  143.  
  144. {          *** er_Flags byte -- for those things that didn't fit into the type byte ***}
  145. {          *** the hardware stores this byte in inverted form                       ***}
  146.            ERFF_MEMSPACE         =  128;     {           Wants to be in 8 meg space. }
  147.            ERFB_MEMSPACE         =  7;       {           (NOT IMPLEMENTED) }
  148.  
  149.            ERFF_NOSHUTUP         =  64;      {           Board can't be shut up }
  150.            ERFB_NOSHUTUP         =  6;
  151.  
  152.            ERFF_EXTENDED         =  32;      {           Zorro III: Use extended size table }
  153.            ERFB_EXTENDED         =  5;       {                      for bits 0-2 of er_Type }
  154.                                              {           Zorro II : Must be 0 }
  155.  
  156.            ERFF_ZORRO_III        =  16;      {           Zorro III: must be 1 }
  157.            ERFB_ZORRO_III        =  4;       {           Zorro II : must be 0 }
  158.  
  159.            ERT_Z3_SSMASK         =  $0F;     {           Bits 3-0.  Zorro III Sub-Size.  How }
  160.            ERT_Z3_SSBIT          =  0;       {           much space the card actually uses   }
  161.            ERT_Z3_SSSIZE         =  4;       {           (regardless of config granularity)  }
  162.                                              {           Zorro II : must be 0        }
  163.  
  164.  
  165. {           ec_Interrupt register (unused) *******************************************}
  166.            ECIB_INTENA           =  1;
  167.            ECIB_RESET            =  3;
  168.            ECIB_INT2PEND         =  4;
  169.            ECIB_INT6PEND         =  5;
  170.            ECIB_INT7PEND         =  6;
  171.            ECIB_INTERRUPTING     =  7;
  172.  
  173.            ECIF_INTENA           =  2;
  174.            ECIF_RESET            =  8;
  175.            ECIF_INT2PEND         =  16;
  176.            ECIF_INT6PEND         =  32;
  177.            ECIF_INT7PEND         =  64;
  178.            ECIF_INTERRUPTING     =  128;
  179.  
  180.  
  181. {**************************************************************************
  182. **
  183. ** these are the specifications for the diagnostic area.  If the Diagnostic
  184. ** Address Valid bit is set in the Board Type byte (the first byte in
  185. ** expansion space) then the Diag Init vector contains a valid offset.
  186. **
  187. ** The Diag Init vector is actually a word offset from the base of the
  188. ** board.  The resulting address points to the base of the DiagArea
  189. ** structure.  The structure may be physically implemented either four,
  190. ** eight, or sixteen bits wide.  The code will be copied out into
  191. ** ram first before being called.
  192. **
  193. ** The da_Size field, and both code offsets (da_DiagPoint and da_BootPoint)
  194. ** are offsets from the diag area AFTER it has been copied into ram, and
  195. ** "de-nibbleized" (if needed).  Inotherwords, the size is the size of
  196. ** the actual information, not how much address space is required to
  197. ** store it.
  198. **
  199. ** All bits are encoded with uninverted logic (e.g. 5 volts on the bus
  200. ** is a logic one).
  201. **
  202. ** If your board is to make use of the boot facility then it must leave
  203. ** its config area available even after it has been configured.  Your
  204. ** boot vector will be called AFTER your board's final address has been
  205. ** set.
  206. **
  207. ***************************************************************************}
  208.  
  209. Type
  210.  
  211.     DiagArea = record
  212.         da_Config       : Byte;         { see below for definitions }
  213.         da_Flags        : Byte;         { see below for definitions }
  214.         da_Size         : Short;        { the size (in bytes) of the total diag area }
  215.         da_DiagPoint    : Short;        { where to start for diagnostics, or zero }
  216.         da_BootPoint    : Short;        { where to start for booting }
  217.         da_Name         : Short;        { offset in diag area where a string }
  218.                                         {   identifier can be found (or zero if no }
  219.                                         {   identifier is present). }
  220.  
  221.         da_Reserved01   : Short;        { two words of reserved data.   must be zero. }
  222.         da_Reserved02   : Short;
  223.     end;
  224.     DiagAreaPtr = ^DiagArea;
  225.  
  226. Const
  227.  
  228. { da_Config definitions }
  229.  
  230.     DAC_BUSWIDTH        = $C0;  { two bits for bus width }
  231.     DAC_NIBBLEWIDE      = $00;
  232.     DAC_BYTEWIDE        = $40;
  233.     DAC_WORDWIDE        = $80;
  234.  
  235.     DAC_BOOTTIME        = $30;  { two bits for when to boot }
  236.     DAC_NEVER           = $00;  { obvious }
  237.     DAC_CONFIGTIME      = $10;  { call da_BootPoint when first configing the }
  238.                                 {   the device }
  239.     DAC_BINDTIME        = $20;  { run when binding drivers to boards }
  240.  
  241. {
  242. ** These are the calling conventions for Diag or Boot area
  243. **
  244. ** A7 -- points to at least 2K of stack
  245. ** A6 -- ExecBase
  246. ** A5 -- ExpansionBase
  247. ** A3 -- your board's ConfigDev structure
  248. ** A2 -- Base of diag/init area that was copied
  249. ** A0 -- Base of your board
  250. **
  251. ** Your board should return a value in D0.  If this value is NULL, then
  252. ** the diag/init area that was copied in will be returned to the free
  253. ** memory pool.
  254. }
  255.  
  256.